#!/usr/bin/env zsh

source ./config.zsh

mkdir -p $DB_DIR

# SQLite3 command to create the table
sqlite3 "$DB_FILE" <<EOF
CREATE TABLE IF NOT EXISTS recorded_list (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    room_id INTEGER NOT NULL,
    start TIMESTAMP NOT NULL,
    end TIMESTAMP,
    title VARCHAR(255) NOT NULL,
    hostname VARCHAR(255) NOT NULL,
    description VARCHAR(255),
    url VARCHAR(255) NOT NULL,
    status INTEGER NOT NULL
);
EOF

sqlite3 "$DB_FILE" "PRAGMA journal_mode=WAL;"

echo "Database and table created successfully in $DB_FILE."
